package com.stylefeng.guns.gateway.common;

/**
 * @auther: madison
 * @date: 2018/11/8 22:50
 * @description:
 */
public class CurrentUser {
    //线程绑定的存储空间
    public static final InheritableThreadLocal<String> threadLocal = new InheritableThreadLocal<>();

    // 将用户信息放入存储空间
    public static void saveUserId(String userId){
        threadLocal.set(userId);
    }

    public static String getCurrentUser(){
        return threadLocal.get();
    }

//    // 将用户信息放入存储空间
//    public static void saveUserInfo(UserInfoModel userInfoModel){
//        threadLocal.set(userInfoModel);
//    }
//
//    public static UserInfoModel getCurrentUser(){
//        return threadLocal.get();
//    }
}
